package dletc.job;

public class AccountThread implements Runnable{
	
	//共享数据银行账户
	Account acc;
	
	//提供一个构造方法，对账户类赋值
	public AccountThread(Account acc){
		this.acc = acc;
	}
	
	@Override
	public void run() {
		
		//取钱额度
		double money = 5000;
		
		//线程同步
		synchronized (this) {
			//调用取钱方法  多线程并发  
			acc.withDrawal(money);
		}
		
				
		//打印取款信息
		System.out.println(Thread.currentThread().getName() + "账户:" + acc.getAccount() + "取款：" + money + "余额：" + acc.getBalance());
		
		
		
	}

}
